<%@ page import="java.util.Map" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>报名人数统计图</title>
    <script src="https://cdn.staticfile.org/echarts/4.3.0/echarts.min.js"></script>
</head>
<body>
<%
    response.setHeader("refresh", "5");
%>
<table>
    <tr>
        <td>
            <div id="sex" style="width: 600px;height:400px;"></div>
        </td>
        <td>
            <div id="province" style="width: 600px;height:400px;"></div>
        </td>
    </tr>
</table>


<script type="text/javascript">
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('sex'));
    var pchart = echarts.init(document.getElementById('province'));


    option = {
        tooltip: {
            trigger: 'item',
            formatter: '{a} <br/>{b}: {c} ({d}%)'
        },
        legend: {
            orient: 'vertical',
            left: 10,
            data: ['男', '女']
        },
        series: [
            {
                name: '报名人数统计',
                type: 'pie',
                radius: ['50%', '70%'],
                avoidLabelOverlap: false,
                label: {
                    show: false,
                    position: 'center'
                },
                emphasis: {
                    label: {
                        show: true,
                        fontSize: '30',
                        fontWeight: 'bold'
                    }
                },
                labelLine: {
                    show: false
                },
                data: [
                    {value: <%=((Map)application.getAttribute("sexMap")).get("男")%>, name: '男'},
                    {value: <%=((Map)application.getAttribute("sexMap")).get("女")%>, name: '女'}

                ]
            }
        ]
    };


    option2 = {
        tooltip: {
            trigger: 'item',
            formatter: '{a} <br/>{b}: {c} ({d}%)'
        },
        legend: {
            orient: 'vertical',
            left: 10,
            data: ['宁夏', '其他']
        },
        series: [
            {
                name: '报名人数统计',
                type: 'pie',
                radius: ['50%', '70%'],
                avoidLabelOverlap: false,
                label: {
                    show: false,
                    position: 'center'
                },
                emphasis: {
                    label: {
                        show: true,
                        fontSize: '30',
                        fontWeight: 'bold'
                    }
                },
                labelLine: {
                    show: false
                },
                data: [
                    {value: <%=((Map)application.getAttribute("provinceMap")).get("宁夏")%>, name: '宁夏'},
                    {value: <%=((Map)application.getAttribute("provinceMap")).get("其他")%>, name: '其他'}

                ]
            }
        ]
    };
    myChart.setOption(option);
    pchart.setOption(option2);
</script>
</body>
</html>